package com.his.system.manager.controller;

import com.his.system.manager.base.BaseResult;
import com.his.system.manager.config.ConstantProperties;
import com.his.system.manager.entity.ChecktemplateEntity;
import com.his.system.manager.service.IChecktemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Controller类
 *
 * @Description
 * @Author Admin
 * @Date 2020-07-17 21:18:41
 */
@Slf4j
@Api(description = "Checktemplate")
@RestController
@RequestMapping(ConstantProperties.SERVICE_VERSION + "/checktemplate")
public class ChecktemplateController {
    @Autowired
    private IChecktemplateService service;

    @ApiOperation(value = "新增", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @RequestMapping(value = "/addEntity", method = RequestMethod.POST)
    public BaseResult<?> addEntity(@ApiParam @RequestBody ChecktemplateEntity entity) {
        Integer res = service.addEntity(entity);
        return BaseResult.buildSuccess(res);
    }

    @ApiOperation(value = "查询列表", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @RequestMapping(value = "/selectByEntity", method = RequestMethod.POST)
    public BaseResult<?> selectByEntity(@ApiParam @RequestBody ChecktemplateEntity entity) {
        List<?> res = service.selectByEntity(entity);
        return BaseResult.buildSuccess(res);
    }
}